package Euler28;

public class NumberDiagonals {
	public static void main(String[] args) {
		long counter = 1;
		long adder = 3;
		long sum = 0;
		
		while(counter<=1001*1001)
		{
			if(counter == adder*adder)
			{
				adder +=2;
			}
			
			sum += counter;
			counter += adder - 1;
		}
		
		System.out.println(sum);
	}
}
